Skip to content

Widen integer differences in monotonic makima (companion to #630) - #634

Draft
pankgeorg wants to merge 10 commits into
SciML:masterfrom
pankgeorg:fix/monotonic-makima-integer-arithmetic
Draft

pankgeorg wants to merge 10 commits into
SciML:masterfrom
pankgeorg:fix/monotonic-makima-integer-arithmetic

Conversation

@pankgeorg

Copy link
Copy Markdown
Contributor

Companion to #630, on top of its head b4d3f1b.
Widens fixed-width integer value and knot differences before subtracting or squaring in the Akima secants and Hermite coefficients, with regression tests for UInt8[3,2], Int8 and a 2^32 knot spacing.
Two-point Akima slope handling is left to #631.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HN2L2WdGLXmGFQeeESvCT1

asinghvi17 and others added 8 commits November 12, 2026 00:51
…iter)

Adds `MonotonicMakimaInterpolation(u, t; kwargs...)`, a shape-preserving
variant of makima. Like `PCHIPInterpolation`, it computes knot slopes and
returns a `CubicHermiteSpline`, so extrapolation, derivatives, integrals and
`cache_parameters` work as for any Hermite spline.

The slopes are:
1. the makima slopes of `AkimaInterpolation(u, t; modified = true)`, reusing
   the existing kernel (split out of `_akima_init!` as `_akima_slopes!`);
2. a sign pass that zeroes a slope whose sign differs from an adjacent
   secant, or whose adjacent secant is zero (flat segments stay flat);
3. a square Fritsch-Carlson limiter: per segment, left to right, if
   max(alpha, beta) > 3 both end slopes are scaled by 3 / max(alpha, beta).

Where steps 2 and 3 do not act, the result is identical to makima.

Also fixes `AkimaInterpolation` with two points, which read an uninitialized
ghost secant; it now gives the straight line through the two points.

The per-dimension wrappers of `du_PCHIP` are generalized into
`_du_per_dimension` and shared by both slope kernels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com>
Harness: claude
Model: claude-opus-5-5
Factory-Task: 22fff5cb-ab23-4f6c-a31f-195f557afeb0
Agent-Harness: Claude 2.1.319
Agent-Model: claude-opus-5-5
Agent-Session: factory task 22fff5cb-ab23-4f6c-a31f-195f557afeb0 on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
…, β)

When max(α, β) > 3 on a segment, compute r = 3 / max(α, β) once and
multiply both end slopes by it. This is the conventional form of the
square rule. Previously the slopes were set to 3s * (α / max(α, β)) and
3s * (β / max(α, β)), which made the larger one exactly 3s; now it is 3s
up to rounding (a few ulps). Since r <= 1, a limited slope still never
grows. The docstring describes the rounding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com>
Harness: claude
Model: claude-opus-5-5
Factory-Task: 8d831c30-b5f6-4950-9cba-449eed9c4c5f
Agent-Harness: Claude 2.1.319
Agent-Model: claude-opus-5-5
Agent-Session: factory task 8d831c30-b5f6-4950-9cba-449eed9c4c5f on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Reduce the MonotonicMakimaInterpolation tests to a compact set: monotone
output on a few random tables, equality with makima where the limiter is
inactive, flat segments, limiter scaling (checks du == r * makima slope),
2-point tables, and an extrapolation/caching smoke test, plus derivative
checks against finite differences for Vector and Matrix data. Drop the
200-case sweep, the redundant edge cases, the integral testset and the
second docs example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com>
Harness: claude
Model: claude-opus-5-5
Factory-Task: 8d831c30-b5f6-4950-9cba-449eed9c4c5f
Agent-Harness: Claude 2.1.319
Agent-Model: claude-opus-5-5
Agent-Session: factory task 8d831c30-b5f6-4950-9cba-449eed9c4c5f on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Used in the citation "SIAM J. Numer. Anal." in the
MonotonicMakimaInterpolation docstring.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com>
Harness: claude
Model: claude-opus-5-5
Factory-Task: 8d831c30-b5f6-4950-9cba-449eed9c4c5f
Agent-Harness: Claude 2.1.319
Agent-Model: claude-opus-5-5
Agent-Session: factory task 8d831c30-b5f6-4950-9cba-449eed9c4c5f on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com>
Co-Authored-By: Codex <noreply@openai.com>
Harness: codex
Model: gpt-6.1-sol
Factory-Task: 031f1039-f80a-483c-925b-8c42fd463210
Agent-Harness: Codex 0.164.0
Agent-Model: gpt-6.1-sol
Agent-Session: factory task 031f1039-f80a-483c-925b-8c42fd463210 on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com>
Co-Authored-By: Codex <noreply@openai.com>
Harness: codex
Model: gpt-6.1-sol
Factory-Task: 2ac96216-b848-4d94-88f8-f574017c8dbc
Agent-Harness: Codex 0.164.0
Agent-Model: gpt-6.1-sol
Agent-Session: factory task 2ac96216-b848-4d94-88f8-f574017c8dbc on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Widen fixed-width secant and Hermite differences before subtracting.
Divide by integer knot spacing twice to avoid overflow in the square.

Co-authored-by: Codex gpt-6.2-sol (codex-cli 0.172.0, session 01a22642-ff44-7e32-84de-f1cca932f790) <noreply@openai.com>
Widen segment differences and avoid standalone offset squares during
evaluation and integration. Use the same width for Akima slopes and
coefficients. Keep native Hermite arithmetic when the square fits.

Co-authored-by: Codex gpt-6.2-sol (codex-cli 0.172.0, session 01a22642-ff44-7e32-84de-f1cca932f790) <noreply@openai.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #634

Reviewed head: 7bf8775
Raw SHA-256: 57d29bbdc1bcc091b32272eb51821e64f41b35880638ff804a3e071b2b89b9e9
Source SHA-256: 4d48e9bcd83a5e2b60a3018321939fdd600b11c805e560bf693b5bc723b9183d
Source: operator-attested-codex-v1 (runner attested by pankgeorg)
Reviewer session: 01a2269b-b34c-7002-947c-c817104b040b
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H1)
  • Verdict: CHANGES
  • Reviewed head: 7bf8775

Review report

VERDICT: CHANGES
PR: #634
Head: 7bf8775
Base: 85f6dd8
Reviewer: codex-cli 0.172.0 / gpt-6.2-sol
Session: 01a2269b-b34c-7002-947c-c817104b040b

Risk

high (H1: The existing public PCHIPInterpolation constructor rejects previously accepted inputs and silently loses precision on others.)

Blocking findings

  • P1 — src/interpolation_utils.jl:643 and src/interpolation_utils.jl:655. The new slope allocation calls oneunit on the container’s declared element type. A Matrix{Union{Float32,Float64}} and the equivalent vector of vectors returned 0.3125 per component before and now throw MethodError. A Matrix{AbstractFloat} containing BigFloat values scaled by 1e-400 silently stores zero slopes and changes the normalized midpoint from 0.3125 to 0.5. Derive the storage type from the scalar kernel’s actual results and add regressions for both container shapes and arbitrary-precision values.
  • P1 — src/interpolation_methods.jl:1364 and src/interpolation_methods.jl:1373. Hermite evaluation still subtracts and squares offsets in the input integer type. For MonotonicMakimaInterpolation([0.,1.,2.], UInt8[0,10,40]), querying UInt8(5) returns -1.1875, below the segment’s [0,1] range. Querying 5.0 returns 0.5902777778. The failure occurs in scalar and sorted-batch evaluation with caching on or off. I also reproduced wrapped offsets in derivatives and integrals at src/derivatives.jl:535 and src/integrals.jl:595. Use safe signed offsets throughout and avoid squaring them in a fixed-width integer type.
  • P2 — src/interpolation_caches.jl:379 and src/interpolation_methods.jl:1368. The promised two-point straight line can return NaN32 for finite inputs. With u = Float32[0,1] and t = Float32[0,1e20], the midpoint should be 0.5f0, but the squared offset overflows. With u = Float32[0,2e38] and t = Float32[0,1], the Makima weight arithmetic already produces nonfinite slopes. Set both two-point slopes directly to the secant and evaluate in normalized segment coordinates.
  • P2 — src/interpolation_caches.jl:442. Akima now widens knot differences for slopes, then uses the original integer arithmetic for the cubic coefficients. With u = [0.,1.,4.], t = Int8[-120,10,120] and modified = true, head returns -264.60 at -55.0, versus 0.26136 with the same knots represented as Float64. The merge base also returned a wrong value. Use the same widened duration throughout coefficient construction and avoid an overflowing integer square.
  • P2 — src/parameter_caches.jl:241. The shared integer coefficient path made uncached Hermite evaluation about 2.5× slower on ARM. With 200 unit-spaced Int64 knots and 3,000 sorted Float64 queries, the median rose from 34.8–34.9 µs to 87.4–87.6 µs across two runs in reversed version order. Float64 knots stayed near 28 µs. Keep a fast path when the duration can be squared safely, retain the overflow-safe fallback, and rerun the benchmark.

Nonblocking findings

  • test/interpolation_tests.jl:2182 and test/interpolation_tests.jl:2212 use expectations derived from Akima, which now shares the slope kernel. These assertions check consistency and can miss a shared slope error. Add an independent fixture. For the existing shallow-segment example, the two limited slopes are 3/10 and 527/2080. The patch removes or skips no existing assertions.
  • src/interpolation_caches.jl:1925 says search_properties skips the knot probe. The delegated constructor at src/interpolation_caches.jl:1794 eagerly evaluates the fallback passed to something. Make the fallback lazy or document that the argument overrides the probe result. This finding is based on reading the code.

What I ran

  • Ran diff -ru before target and git apply --check against before/ and target/, plus a reverse check against head/. The patch applied cleanly to a scratch copy of target. julia --startup-file=no --project=.review/merged-env .review/target-smoke.jl passed all four sorted-knot assertions. Retain target’s version bump and sorted-knot validation. Port the verified two-point Akima fix and the new API after addressing the blockers.
  • Ran .review/makima-tests.jl with Julia 1.10.14 and 1.13.4 on aarch64. All 59 assertions passed on each version. On 1.13.4, .review/makima-derivatives.jl passed 684 assertions and .review/shared-tests.jl passed 577 Akima, 44 cubic Hermite, and 19 PCHIP assertions. Separate probes passed for N-dimensional output, input validation, symbolic substitution, and an independent limiter and gradient check.
  • Ran .review/wrong-to-right.jl on the merge base and head. Both two-point Akima modes and both cache modes for the wide-integer-knot Hermite case failed before and passed after. Ran .review/probes.jl, .review/pchip.jl, .review/abstract-float.jl, and .review/extra.jl to reproduce the numerical and compatibility findings.
  • Ran .review/bench.jl with BenchmarkTools on the merge base and head in both orders. The integer Hermite slowdown reproduced. Float64 Akima and matrix PCHIP construction timings were similar.
  • Read ci.json. It lists zero head checks, 20 target successes, and two target skips. Those results supply no execution evidence for the changed head paths.

What I did not verify

The full interpolation, interface, parameter-cache, and derivative file runs had no result by the end of the review. The focused runs above exercised the affected testsets. Documentation builds, downstream packages, other optional extensions, prerelease Julia, and 32-bit x86 remain unverified. No GPU-specific change was present in the patch, and no compute GPU was available in the ARM sandbox.

Head link: 7bf8775


🤖 Posted by an AI agent — harness: codex-cli 0.172.0 · model: gpt-6.2-sol
Conversation: local session 01a2269b-b34c-7002-947c-c817104b040b (no session URL)

@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #634

Reviewed head: 480e42b
Raw SHA-256: 3dbe7c19e06fbff60ce51c46f01eda4a7075fcb77515afed72d5dd9d691fbbcd
Source SHA-256: d669dede80ac1bd0901e700595d93469da5d306e9b146e26852ab4379cd931b9
Source: operator-attested-codex-v1 (runner attested by pankgeorg)
Reviewer session: 01a226db-f5cb-7fb1-94df-2ad8b3aa8674
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H2)
  • Verdict: CHANGES
  • Reviewed head: 480e42b

Review report

VERDICT: CHANGES
PR: #634
Head: 480e42b
Base: 85f6dd8
Reviewer: codex-cli 0.172.0 / gpt-6.2-sol
Session: 01a226db-f5cb-7fb1-94df-2ad8b3aa8674

Risk

high (H2: The patch changes default cubic evaluation and integration, and a previously finite Hermite evaluation now returns Inf.)

Blocking findings

  • P1 src/interpolation_methods.jl:1373 — The new evaluation order overflows before multiplying by the query offset. With CubicHermiteSpline([1.75e308, 1.35e308], [0.0, 8.75e307], [0.0, 0.5]), the merge base and target both return 4.625e307 at 0.25. Head returns Inf through both scalar and sorted-batch evaluation. Scale the linear and cubic contributions separately before adding them, and test both entry points.
  • P1 src/interpolation_utils.jl:805 — Floating-point widths are squared without a range check. On head, MonotonicMakimaInterpolation(t, t) with t = Float16[0, 1e-4] returns NaN at the midpoint and right knot with either cache setting. With values Float32[0, 1, 2] at knots Float32[0, 1e20, 3e20], it returns about 2.3 at the last knot. Use normalized segment coefficients or scale the calculation when the square would underflow or overflow. Test both knot reproduction and interior values.
  • P2 src/interpolation_caches.jl:379 — The two-point case still runs the weight calculation, which can overflow even when the secant is representable. MonotonicMakimaInterpolation([0.0, 1e308], [0.0, 1.0])(0.5) returned NaN instead of 5e307. Assign the secant directly to both slopes and set the higher-order Akima coefficients to zero for two-point tables.
  • P2 src/interpolation_utils.jl:679 — The revised cubic integral creates extra array temporaries on existing matrix-valued paths. In a repeated target-to-head benchmark, allocations per call rose from 2,482 to 5,210 for Akima, from 5,210 to 7,938 for Hermite, and from 7,938 to 12,898 for CubicSpline. Fuse the coefficient-array arithmetic or retain the lower-allocation formula for safely representable offsets.

Nonblocking findings

  • test/interpolation_tests.jl:2182 and test/interpolation_tests.jl:2214 — Both sides of these slope comparisons depend on _akima_slopes!, so a shared slope error can pass. The patch also adds independent shape and analytic-value assertions. Add a limiter-active fixture with independently computed knot slopes and segment values.
  • src/derivatives.jl:134 — Reflective extrapolation reverses the sign of the second derivative. The target’s Hermite spline returned -3 at 0.75 and +3 at its mirror 1.25. The new Makima constructor inherits the same behavior. Apply the reflection sign only to the first derivative and add a test with nonzero curvature.

What I ran

  • diff -qr before head, diff -qr before target, and git apply --check against before and target, plus a reverse check against head. The patch applies cleanly over target. Port the corrected patch onto target’s 10.1.5, retaining its matrix and N-dimensional sorted-knot validation and tests.
  • julia --startup-file=no --project=.review-{before,target,env} .review-env/before-after-tests.jl, once per environment, using Julia 1.13.4 on Linux ARM64. The same seven assertions failed on both the merge base and target and passed on head. They covered two-point Akima, integer widths in Akima and Hermite, and fractional PCHIP slopes for integer matrix data. I independently derived the Akima midpoint 23/88 with Python’s Fraction.
  • Ran the head interface file and extracted test sets with the same Julia environment. The interface file completed, all 123 new interpolation assertions and 684 finite-difference derivative assertions passed, and all 4,932 cubic integration assertions passed against quadrature. A separate unsigned-offset extrapolation test passed 96 assertions, and symbolic substitution produced the expected 0.3125. The patch adds tests without removing or skipping existing assertions.
  • Ran .review-env/probes.jl against all three snapshots and ran .review-env/bench.jl and .review-env/arraybench.jl against target and head, then repeated the benchmarks with taskset -c 70. Sampled checksums matched. In the pinned run, median Int64 Akima construction rose from 21.7 to 64.5 µs and sorted Hermite evaluation from 10.0 to 16.4 µs for 1,024 knots.

What I did not verify

  • I interrupted the broader Core and Methods/QA invocations after they produced no completion result. I did not run the documentation build, the full extension suite, Julia 1.10, 32-bit Julia, or downstream benchmarks.
  • GPU execution was unavailable on this ARM64 runner. The patch and supplied check metadata identify no GPU-specific changed path.
  • ci.json contains zero head checks. The listed successful Core and Methods jobs belong to the target commit and provide no head execution evidence. Target Core · Target Methods

Head link: 480e42b


🤖 Posted by an AI agent — harness: codex-cli 0.172.0 · model: gpt-6.2-sol
Conversation: local session 01a226db-f5cb-7fb1-94df-2ad8b3aa8674 (no session URL)

Restore the original floating-point evaluation and integral formulas.
Keep checked widths and factored offsets on fixed-width integer paths.
Add a finite Hermite regression and matrix integral benchmarks.

Co-authored-by: Codex gpt-6.2-sol (codex-cli 0.172.0, session 01a22642-ff44-7e32-84de-f1cca932f790) <noreply@openai.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #634

Reviewed head: 48ac791
Raw SHA-256: d72a97bc5017d76cf11aa558f1e61a321e0ac3a2ed413a9307e8baa67d12f248
Source SHA-256: e7f744c693c72830b26d0a170d9e0834b13a1e270cb161adc7a3ba210b2643b4
Source: operator-attested-codex-v1 (runner attested by pankgeorg)
Reviewer session: 01a22700-14d6-7321-b954-06d0a6bba8e1
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H2)
  • Verdict: CHANGES
  • Reviewed head: 48ac791

Review report

VERDICT: CHANGES
PR: #634
Head: 48ac791
Base: 85f6dd8
Reviewer: codex-cli 0.172.0 / gpt-6.2-sol
Session: 01a22700-14d6-7321-b954-06d0a6bba8e1

Risk

high (H2: The patch changes default numerical arithmetic in Akima, cubic Hermite, PCHIP, and shared cubic integration.)

Blocking findings

  • P1 src/interpolation_utils.jl:674 — Integer knots substantially slow matrix-valued integration. For an 8×12 Akima table with knots 0:11, integral(A, 0.25, 10.75) went from 3.99 to 7.59 μs and from 222 to 464 allocations. Cubic Hermite and CubicSpline also allocated more. Keep the compact calculation when checked offsets and products fit, and fuse array operations in the overflow fallback. Add an integer-knot case to the benchmark.
  • P2 src/interpolation_caches.jl:379 and src/parameter_caches.jl:250 — The two-point path can return NaN on a representable straight line. Both Akima and Monotonic Makima returned NaN16 at 0.5 for Float16[0, 40000] on knots Float16[0, 1], where the answer is 20000. Monotonic Makima also returned NaN for values [0., 1.] on [0., 1e-170], where the squared width underflows. Use the secant directly for two-point slopes and form the linear segment without the overflowing weight sums or a squared-width division.
  • P2 src/derivatives.jl:98 and src/derivatives.jl:134 — Reflective extrapolation returns the wrong second-derivative sign. Monotonic Makima on values [0., 1., 2.] and knots [0., 10., 40.] returned +13/1800 at -5 instead of -13/1800. This reproduced with scalar and three-dimensional data, with both cache settings. The new API inherits the shared bug. Apply the reflection factor twice for order two and add left and right regression cases.
  • P2 src/interpolation_utils.jl:626 — Symbolic substitution loses the overflow-safe limiter behavior. Substituting [0., 1e-200, 1e200, 2e200] into a symbolic Monotonic Makima interpolant on [0., 1., 2., 3.] produced NaN at 0.5. Direct numeric construction returned 1.25e-201. Choose the scaling from slope and secant magnitudes before forming an overflowing ratio, and test the evaluated symbolic expression.
  • P2 src/interpolation_utils.jl:804 — Small Int128 knots force arbitrary-precision results on an existing working path. For a cubic Hermite spline with Float64 values and slopes and knots Int128[0, 1, 2, 3], scalar evaluation and integration returned Float64 before and BigFloat on head. This changes downstream dispatch and arithmetic cost. Preserve the existing numeric type when the offsets fit and reserve multiprecision for cases that require it.

Nonblocking findings

  • test/interpolation_tests.jl:2192 and test/interpolation_tests.jl:2222 use Akima slopes from the shared implementation as expected values. These checks cover limiter behavior but can miss a shared slope error. Keep the independent rational-value cases and add a fixed reference for a segment where both end slopes are limited. The diff removes or skips no existing checks.
  • src/interpolation_caches.jl:1925 promises that supplied search_properties skip the knot probe. The delegated constructor at line 1794 evaluates the fallback argument to something eagerly. Use a lazy fallback or revise the documentation.

What I ran

  • git apply --check ../changes.diff from before/ and target/, then applied the patch to a scratch copy of target. The port retained target’s version and sorted-knot validation. Port the new constructor and demonstrated fixes after addressing the blockers, keeping the target’s array validation and its tests.
  • Using local offline Julia environments, ran .review/regressions.jl on both snapshots. The merge base had 4 passes, 9 failures, and 1 error. Head passed all 14. This demonstrated fixes for ordinary two-point Akima, wide integer Hermite offsets, an unsigned Akima second derivative, and integer-valued PCHIP matrices. The large finite Hermite contribution case passed on both snapshots.
  • Included the changed Makima test set on Julia 1.13.4 head and Julia 1.10.14 patched target. All 123 assertions passed on each. The patched target also rejected unsorted matrix knots. Directly included the interface, abstract interface, extrapolation, parameter, and allocation test files on head. All 394 assertions passed. The Akima, Hermite, and Makima derivative excerpts passed 17,693 assertions, and the three cubic integral excerpts passed 4,932.
  • Ran .review/probes.jl, .review/edges.jl, .review/newapi.jl, and .review/symbolic.jl for the numerical and API cases above. Ran .review/benchmarktools.jl and .review/bench.jl on both snapshots. Both benchmark runs found higher allocation counts for integer-knot matrix integration. Cached sorted Hermite evaluation with Int64 knots and queries went from 1.08 to 2.70 μs in BenchmarkTools. Floating-knot matrix integral allocation counts were identical.

What I did not verify

  • The full interpolation test file and combined derivative/integral run did not finish during the review. I did not run the complete package matrix, documentation build, extension suites, or downstream benchmarks.
  • The runner is AArch64 with no accessible GPU device. I found no GPU-specific paths in the changed package code or test configuration. GPU execution and 32-bit execution were unverified.
  • ci.json contains no head checks. The supplied base Core and Methods jobs report success for the target commit. Their labels do not establish coverage of the head paths reviewed here. Base Core · Base Methods

Head link: 48ac791


🤖 Posted by an AI agent — harness: codex-cli 0.172.0 · model: gpt-6.2-sol
Conversation: local session 01a22700-14d6-7321-b954-06d0a6bba8e1 (no session URL)

Check integral and sorted Hermite offsets before using the compact
formulas. Fuse the wide integral fallback for array-valued samples
and keep small 128-bit differences in native signed arithmetic.

Co-authored-by: Codex gpt-6.2-sol (codex-cli 0.172.0, session 01a22642-ff44-7e32-84de-f1cca932f790) <noreply@openai.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #634

Reviewed head: 3f142e9
Raw SHA-256: e4a3842cedd826e747a1cbf4e4ccdfa7783963cacc182236f7b594b5dca6f321
Source SHA-256: 2822fae332da061aa98fbe313242b2d97de1d60870bd5f70c2ea8b392caefe68
Source: operator-attested-codex-v1 (runner attested by pankgeorg)
Reviewer session: 01a22729-7a23-7191-9656-c0e65ae8dd38
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=8)

Risk assessment

  • Risk: high (H2)
  • Verdict: CHANGES
  • Reviewed head: 3f142e9

Review report

VERDICT: CHANGES
PR: #634
Head: 3f142e9
Base: 85f6dd8
Reviewer: codex-cli 0.172.0 / gpt-6.2-sol
Session: 01a22729-7a23-7191-9656-c0e65ae8dd38

Risk

high (H2: The patch changes default numerics in existing spline paths and turns a previously finite PCHIP result into -Inf.)

Blocking findings

  • P1. PCHIP narrows slopes for abstractly typed arrays. With u = reshape(Real[0, s, 4s, 9s], 1, :) and s = big"1e400", PCHIPInterpolation(u, 0:3)(0.5) returns 0.3125s on the merge base and -Inf on head. The new allocator infers Float64 from oneunit(Real) and converts finite BigFloat slopes to Inf. Preserve abstract slope storage for abstract inputs or derive the storage type from the computed slopes. Cover matrices and vectors of vectors. src/interpolation_utils.jl:643
  • P2. Two-point Akima and Monotonic Makima return NaN for a representable straight line. With values [0.0, 9e307] and knots [0.0, 1.0], both return NaN at 0.5 instead of 4.5e307. The two-point branch fills the padded secants, then runs weight and coefficient calculations that overflow. Assign both slopes directly from the secant and initialize Akima’s quadratic and cubic coefficients to zero. src/interpolation_caches.jl:380
  • P2. Monotonic Makima can miss its own knots in Float16. With h = Float16(0.01), values Float16[0, 1, 0], and knots Float16[0, h, 2h], head returns NaN at 0 and h, and Inf at h/2. The Hermite coefficients overflow in knot coordinates even though the knot slopes and interpolated values are representable. Use normalized segment coordinates or a wider-arithmetic fallback, and test knot and midpoint values. src/parameter_caches.jl:250

Nonblocking findings

  • The limiter tests use AkimaInterpolation.b for several expected slopes. Both constructors share the slope kernel, so those assertions can miss a shared error. Add hand-computed slopes for an inactive-limiter case and retain the agreement checks. The diff removes or skips no existing assertions. test/interpolation_tests.jl:2197
  • Two warm benchmark runs showed cached Hermite evaluation at a small scalar integer query rising from about 34 ns to 46 ns and its first derivative from 31 ns to 47–48 ns. The 199-query batch rose from 1.07 µs to 1.12–1.13 µs, with zero allocations throughout. Add scalar evaluation and differentiation to the committed benchmark and consider a checked native-width path for small offsets. src/interpolation_methods.jl:1375 · src/derivatives.jl:543

What I ran

  • Compared before and target with diff -qr. git apply --check passed on before and target, and the reverse check passed on head. A scratch port preserved target’s 10.1.5 version and sorted-knot validation. Four assertions confirmed that the port rejects unsorted matrix and higher-dimensional inputs.
  • Ran julia --startup-file=no --compile=min --project=.review/<env> .review/regressions.jl against the merge base, head, and scratch port on Linux aarch64 with Julia 1.13.4. The merge base had 16 failures and two errors. Head and the port each passed all 20 assertions covering ordinary two-point Akima, wide-integer Hermite, and integer array PCHIP. The same 20 assertions passed on head with Julia 1.10.14 using normal compilation.
  • Ran .review/failures.jl in the same environments. The PCHIP regression assertion passed on the merge base. All six assertions covering the three blocking findings failed on head and on the scratch port. Normal compilation reproduced all six failures on head.
  • Ran the new Makima blocks from test/interpolation_tests.jl and test/Methods/derivative_tests.jl using include_string. All 123 interpolation assertions and 684 derivative assertions passed. The Symbolics constructor smoke test, six full-span Int128 assertions, and 36 mixed-bound array integral assertions also passed.
  • Ran JULIA_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 julia --startup-file=no --project=.review/<env> .review/bench.jl twice per snapshot, using the same head benchmark definitions for both. Array integral timings were noisy and allocation counts matched. Merge-base timings · Head timings
  • Read ci.json. It supplies no head checks. Target’s successful Core and Methods labels establish only the recorded target job outcomes. [Core, Julia 1]​(https://github.com/SciML/DataInterpolations.jl/runs/140708214508) · Methods, Julia 1

What I did not verify

The broader file-level suites had produced no result when the review ended. I did not verify the complete CI matrix, 32-bit execution, the extension suites, the docs build, or downstream performance. No GPU device was exposed on the ARM host, and I found no GPU-specific changed path to exercise.

Head link: 3f142e9


🤖 Posted by an AI agent — harness: codex-cli 0.172.0 · model: gpt-6.2-sol
Conversation: local session 01a22729-7a23-7191-9656-c0e65ae8dd38 (no session URL)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants